<!--_meta 作为公共模版分离出去-->
<include file='public/_meta'>
<!--/meta 作为公共模版分离出去-->

<title>编辑</title>
<meta name="keywords" content="H-ui.admin v3.1,H-ui网站后台模版,后台模版下载,后台管理系统模版,HTML后台模版下载">
<meta name="description" content="H-ui.admin v3.1，是一款由国人开发的轻量级扁平化网站后台模板，完全免费开源的网站后台管理系统模版，适合中小型CMS后台系统。">
</head>
<body>
<article class="page-container">
	<form action="{:url('index/maintain/edit')}" method="post" class="form form-horizontal" id="form-member-add" enctype="multipart/form-data">
		<input type="hidden" name="id" value="{$data.id}">
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>车牌号：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{$data.car_sn}" placeholder=""  name="car_sn" disabled="">
			</div>
		</div>

		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red"></span>保养日期：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text Wdate" value="{$data.maintain_time}" onfocus="WdatePicker()" placeholder=""  name="maintain_time">
			</div>
		</div>

		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red"></span>保养类型：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{$data.style}" placeholder="" name="style">
			</div>
		</div>

		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">保养费用(元)：</label>
			<div class="formControls col-xs-8 col-sm-9"> 
				<input type="text" class="input-text" value="{$data.money}" placeholder="" id="money" name="money">

			</div>
		</div>

		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">距上次保养天数：</label>
			<div class="formControls col-xs-8 col-sm-9"> 
				<input type="text" class="input-text" value="{$data.maintain_date}" placeholder="" name="maintain_date">

			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">保养时累计天数：</label>
			<div class="formControls col-xs-8 col-sm-9"> 
				<input type="text" class="input-text" value="{$data.all_date}" placeholder="" name="all_date">

			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">保养时累计里程：</label>
			<div class="formControls col-xs-8 col-sm-9"> 
				<input type="text" class="input-text" value="{$data.mileage}" placeholder="" name="mileage">

			</div>
		</div>
		<foreach $data['maintain_file'] as $value>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">原有附件：</label>
			<div class="formControls col-xs-8 col-sm-9"> 
				<ul>
					<li><a href="__UPLOADS__/{$value.file_url}" target="_blank"><i class="icon Hui-iconfont f-30">&#xe613;</i></a><a href="javascript:void(0);" onclick="product_del(this,{$value['id']})" class="ml-10">删除</a></li>	
				</ul>
			</div>
		</div>
		</foreach>
		<div class="row cl">	
			<label class="form-label col-xs-4 col-sm-3">附件：</label>
			<div class="formControls col-xs-8 col-sm-9"> <span class="btn-upload form-group">
				<input class="input-text upload-url" type="text" id="uploadfile" readonly nullmsg="请添加附件！" style="width:200px">
				<a href="javascript:void();" class="btn btn-primary radius upload-btn"><i class="Hui-iconfont">&#xe642;</i> 浏览文件</a>
				<input type="file" name="uploadfile[]" class="input-file">
				</span> </div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">备注：</label>
			<div class="formControls col-xs-8 col-sm-9"> 
				<textarea class="textarea" name="desc">{$data.maintain_desc}</textarea>

			</div>
		</div>
		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
				<input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
			</div>
		</div>
	</form>
</article>

<!--_footer 作为公共模版分离出去-->
<include file='public/_footer'>
<!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本--> 
<script type="text/javascript" src="__PUBLIC__/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="__PUBLIC__/lib/jquery.validation/1.14.0/jquery.validate.js"></script> 
<script type="text/javascript" src="__PUBLIC__/lib/jquery.validation/1.14.0/validate-methods.js"></script> 
<script type="text/javascript" src="__PUBLIC__/lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript">
$(function(){
	$('.skin-minimal input').iCheck({
		checkboxClass: 'icheckbox-blue',
		radioClass: 'iradio-blue',
		increaseArea: '20%'
	});
	
	$("#form-member-add").validate({
		rules:{
			car_sn:{
				required:true,
				minlength:2,
				maxlength:60
			},
			
		},
		onkeyup:false,
		focusCleanup:true,
		success:"valid",
		submitHandler:function(form){
			$(form).ajaxSubmit({
				 success: function(data) { 
				 	var index = parent.layer.getFrameIndex(window.name);
					//parent.$('.btn-refresh').click();
                if(data['status']==0){
                
                	layer.msg(data['msg'], {icon:6,time:1000},function(){

						parent.location.href = '{:url('index')}';              		
						parent.layer.close(index);
                	});

                }else{
                	layer.msg(data['msg']);

                }
            }


			});

		}
	});
});

$(".textarea").Huitextarealength({
	maxlength:100,
	exceed:false,
});

/*文件-删除*/
function product_del(obj,id){
	layer.confirm('确认要删除吗？',function(index){
		$.ajax({
			type: 'POST',
			url: '{:url('del_file')}',
			data:{'id':id},
			dataType: 'json',
			success: function(data){
				if(data.status == 0){

				$(obj).parents("li").remove();
				layer.msg('已删除!',{icon:1,time:1000});
				}else{
					layer.msg(data['msg']);
				}
			},
			error:function(data) {
				console.log(data.msg);
			},
		});		
	});
}
</script> 
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>